package org.fluidripple.common;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class Result <T>{

    private String message;
    private int code;
    private T data;

    public static <T> Result<T> sucess(T data){
        Result<T> result = new Result<>();
        result.setCode(200);
        result.setData(data);
        result.setMessage("成功");
        return result;
    }

    public static <T> Result<T> sucess(){
        Result<T> result = new Result<>();
        result.setCode(200);
        result.setMessage("成功");
        return result;
    }

    public static Result error(String message){
        Result result = new Result();
        result.setCode(500);
        result.setMessage(message);
        return result;
    }
}
